<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="Simple html link grabber from danbooru-like sites such as: konachan.com, oreno.imouto.org, danbooru.donmai.us, behoimi.org" />
    <meta name="keywords" content="danbooru, batch, links, download, tags, konachan, behoimi, imouto, trolling" />
    <title>Danbooru link grabber v2</title>
    <style type="text/css">
        body {
            margin: 0;
            color: #fff;
            font-family: verdana, sans-serif;
            font-size: 80%;
            background: #222;
            padding: 1em 3em;
        }
        input, select {
            margin-bottom: 1em;
        }
        a, a:visited {
            color: #e88;
            text-decoration: none;
        }
        a:hover {
            color: #f99;
        }
        h1 {
            margin-left: 5em;
        }
        .head {
            height: 150px;
            background: url("dlg-logo.png") no-repeat;
        }
        .menu {
            float: left;
            width: 15%;
            margin-right: 1em;
            overflow: visible;
            text-align: center;
            white-space: nowrap;
        }
        .debug {
            color: #555;
            font-size: 80%;
        }
        .content {
            float: left;
            width: 75%;
            bottom: 0;
            margin-left: 2em;
            display: table-cell;
            height: 100%;
        }
        div.links ul#subnavbar {
            background-color: #333;
            margin: 0 0 1em -50px;
            padding: 5px 20px 5px 65px;
        }
        div.links ul#subnavbar li {
            padding: 0 5px;
        }
        ul.flat-list {
            display: block;
            margin: 0;
            padding: 0;
        }
        ul.flat-list li {
            display: inline;
            font-weight: bold;
            list-style-type: none;
            margin: 0 1em 0 0;
            padding: 0;
        }
        ul.flat-list li a {
            font-weight: normal;
        }
        div.links ul#navbar {
            margin: -10px 10px 0 0;
            padding: 5px 20px 0 10px;
        }
        div.links ul#navbar li {
            font-size: 120%;
            margin: 0;
            padding: 0 10px;
        }
        div.links ul#navbar li.selected {
            background-color: #333333;
        }
    </style>
    <script type="text/javascript" src="jquery-1.6.4.min.js"></script>
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-19947392-1']);
        _gaq.push(['_trackPageview']);
        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
    </script>
    <script type="text/javascript">
        function showHelp(){
            $("#help").slideDown("slow");
            $("#result").slideUp("slow");
        }
        
        function processRequest(){
            var site, tags, limit, page;
            limit   = document.getElementById("limit").value;
            site    = document.getElementById("site").value;
            tags    = document.getElementById("tags").value;
            page    = document.getElementById("page").value;
            user    = document.getElementById("user").value;
            pass    = document.getElementById("pass").value;
            document.getElementById("button").disabled = true;
            document.getElementById("button").value = "Wait...";
//            $("#result").html("Loading...");
            $("#help").slideUp("slow");
            $("#result").slideUp("slow");
            $("#result").load(
                    "api.php",
                    {
                        site: site,
                        tags: tags,
                        limit: limit,
                        user: user,
                        pass: pass,
                        page: page
                    },
                    function(){
                        document.getElementById("button").disabled = false;
                        document.getElementById("button").value = "Process";
                        $("#result").slideDown("fast");
                    }
            );
        }
    </script>
</head>
<body>
    <div class="head" style="border-radius: 20px;">
        <div style="font: bold 24pt sans-serif; text-shadow: white 0 0 10px, black 0 0 5px;">
            <!--Danbooru link grabber-->
        </div>
    </div>
    <div>
        <div class="links">
            <ul class="flat-list" id="navbar">
                <li class="selected">Simple html link grabber from danbooru-like sites</li>
                <li><a href="http://forum.ruanime.org/index.php/topic,10.0.html?language=english">Forum</a></li>
                <li><a href="#" onclick="showHelp();">Help</a></li>
            </ul>
            <ul class="flat-list" id="subnavbar">
                <li><a href="http://konachan.com/" target="_blank">konachan.com</a></li>
                <li><a href="https://yande.re/" target="_blank">yande.re (oreno.imouto.org)</a></li>
                <li><a href="http://danbooru.donmai.us/" target="_blank">danbooru.donmai.us</a></li>
                <li><a href="http://behoimi.org/" target="_blank">behoimi.org</a></li>
                <li><a href="http://chan.sankakucomplex.com/" target="_blank">chan.sankakucomplex.com</a></li>
                <li><a href="http://idol.sankakucomplex.com/" target="_blank">idol.sankakucomplex.com</a></li>
            </ul>
        </div>
    </div>
    <div class="menu" style="border-radius: 20px;">
        <label for="site">Site</label><br />
        <select size="1" id="site" name="url" style="width: 100%">
            <option value="konachan" selected="selected">konachan.com</option>
            <option value="yande">yande.re</option>
            <option value="donmai">danbooru.donmai.us</option>
            <option value="behoimi">behoimi.org</option>
            <option value="chan.sankakucomplex">chan.sankakucomplex.com</option>
            <option value="idol.sankakucomplex">idol.sankakucomplex.com</option>
        </select><br />
        <label for="tags">Tags</label><br />
        <input id="tags" name="tags" type="text" value="ore_no_imouto_ga_konna_ni_kawaii_wake_ga_nai" style="width: 100%" /><br />
        <label for="limit">Limit</label><br />
        <!--<input id="limit" name="limit" type="text" value="1000" style="width: 100%" /><br />-->
        <select size="1" id="limit" name="limit" style="width: 100%">
            <option value="1">1</option>
            <option value="10">10</option>
            <option value="50">50</option>
            <option value="100">100</option>
            <option value="500">500</option>
            <option value="1000" selected="selected">1000 (recommended)</option>
            <option value="2000">2000</option>
            <option value="5000">5000</option>
            <option value="10000">10000 (max)</option>
        </select><br />
        <label for="page">Page</label><br />
        <input id="page" name="page" type="text" value="1" style="width: 100%" /><br />
        <label for="user">User &amp; pass if requested*</label><br />
        <input id="user" name="user" type="text" value="" style="width: 45%" />
        <input id="pass" name="pass" type="password" value="" style="width: 45%" />
        <div style="font-size: 8px; margin-top: -1em; white-space: normal;">*for sites where anonymous access to the API is not supported.</div>
        <br /><br />
        <input id="button" type="button" style="width: 100%" value="Process" onclick="processRequest();" />
    </div>
    <div class="content" >
        <div align="left" id="help">
            <h2>Step 1</h2>
            Choose a site to grab from.

            <h2>Step 2</h2>
            Copypaste tags from the site you've chosen into the &quot;Tags&quot; field here.<br />
            Use &quot;Advanced&quot; search on sites (e.g.
            <a href="http://konachan.com/post/advanced_search">http://konachan.com/post/advanced_search</a>)
            to generate some good tags.

            <h2>Step 3</h2>
            Choose limit value (how much links to grab) and page number.<br />
            Recommended value of limit: 1000 (100 for <i>sankakucomplex</i>).
            Maximum: 10000 (1000 for <i>sankakucomplex</i>).<br />
            If you want MOAR, you should increase <i>page</i> value and process request page-by-page.<br />
            Example: if you want grab 20k links, the best way is to request 4 times with 5k limit per page.
            Otherwise you may as well get nothing.

            <h2>Step 4</h2>
            Press the &quot;Process&quot; button... and wait. If you dont get any results - try again.

            <h2>Step 5</h2>
            ???

            <h2>PROFIT!!</h2>
        </div>
        <div align="center" id="result"></div>
    </div>
</body>
</html>